import 'dart:async';
import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

import 'package:webview_flutter/webview_flutter.dart';
import 'package:webview_flutter_web/webview_flutter_web.dart';

class WebviewDemo extends StatefulWidget {
  @override
  State<WebviewDemo> createState() => _WebviewDemoState();
}

class _WebviewDemoState extends State<WebviewDemo> {
  // final Completer<WebViewController> _controller =
  // Completer<WebViewController>();
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    if (kIsWeb) {
      WebView.platform = WebWebViewPlatform();
    }else if (Platform.isAndroid) {
      WebView.platform = SurfaceAndroidWebView();
    }
  }

  @override
  Widget build(BuildContext context) {
    return WebView(
       initialUrl: 'assets/www/index.html',
      // ini
      onWebViewCreated: (WebViewController webViewController){
      },
      onPageFinished: (String url){

      },
      javascriptMode: JavascriptMode.unrestricted,


    );
  }
}
